package com.qqtech.qquan.im.enums;


public enum ImRetrunEnum {

	SUCESS(0, "成功"), FAIL(1, "失败");
	private int code;
	private String desc;

	private ImRetrunEnum(int code, String desc) {
		this.desc = desc;
		this.code = code;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public static String getDesc(Integer code) {
		ImRetrunEnum statusEnum = getInstance(code);
		if (statusEnum != null) {
			return statusEnum.getDesc();
		}
		return "";
	}

	public static ImRetrunEnum getInstance(Integer code) {
		if (code != null) {
			for (ImRetrunEnum statusEnum : ImRetrunEnum.values()) {
				if (code.equals(statusEnum.getCode())) {
					return statusEnum;
				}
			}
		}
		return null;
	}
}
